package com.jungle.base.service.impl;

import com.jungle.common.constant.PathConstant;
import com.jungle.framework.chat.ChatExecuteRes;
import com.jungle.base.service.IChatService;
import com.jungle.framework.chat.OpenAiApi;
import com.jungle.framework.config.properties.ChatProperties;
import com.jungle.framework.config.properties.DevProxyProperties;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@RequiredArgsConstructor
@Service
@Slf4j
public class ChatServiceImpl implements IChatService {

    private final ChatProperties chatConfig;
    private final DevProxyProperties devProxyProperties;
    @Override
    public ChatExecuteRes chatCompletions(String msg) {
        OpenAiApi api = new OpenAiApi(chatConfig,devProxyProperties);
        return api.post(PathConstant.OPENAI.CHAT_COMPLETION, msg);
    }



}
